<template>
	<u-index-list :scrollTop="scrollTop" :index-list="letterList">
		<view v-for="(item, index) in indexList" :key="index">
			<u-index-anchor :index="item.initial" />
			<view class="list-cell">
				<u-collapse :head-style="headStyle" :body-style="bodyStyle" event-type="close" :arrow="arrow" :accordion="accordion">
					<u-collapse-item :index="index1" :title="son.prov" v-for="(son, index1) in item.provList"
						:key="index1">
						<view class="collapse-item" v-for="(sun ,index2) in son.dataList" :key="index2">
							<view class="box">
								<text class="city">{{sun.city}}</text>
								<view class="pip">{{sun.gb}}</view>
							</view>
							<view class="bottom">
								<text class="bottom-title">{{sun.context}}</text>
							</view>
						</view>
					</u-collapse-item>
				</u-collapse>
			</view>
		</view>
	</u-index-list>
</template>

<script>
	import API from "@/api/report.js"
	export default {
		data() {
			return {
				scrollTop: 0,
				indexList: [],
				letterList: [],
				headStyle: {
					width:'752rpx',
				},
				bodyStyle:{
					width:'680rpx',
				},
				itemList: []
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		onShow() {
			this.getLimitList()
		},
		methods: {
			getLimitList() {
				let token = uni.getStorage({
					token: token
				})
				API.getLimitedList({
					token
				}).then(res => {
					// console.log(res)
					this.indexList = res.data
					// this.letterList
					for (let i = 0; i < res.data.length; i++) {
						// console.log(res.data[i].initial)
						this.letterList[i] = res.data[i].initial
					}
				})
			}
		}
	}
</script>

<style scoped>
	.bottom-title{
		font-size: 24rpx;
	}
	.box{
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	.city{
		font-size: 28rpx;
		color: #000000;
		margin-right: 20rpx;
	}
	.pip{
		width: 50rpx;
		height: 34rpx;
		background-color: #efd5c6;
		font-size: 20rpx;
		text-align: center;
		line-height: 34rpx;
		border-radius: 5rpx;
		color: #ff5d25;
		margin-top: 7rpx;
	}
	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}

	.collapse-item {
		color: #95989a;
		border-bottom: 2rpx solid #caced1;
		padding-bottom: 20rpx;
		padding-top: 20rpx;
	}


</style>
